-- By Lun Au (2005-01-20)
-- Description: Data Migration for "Previous Task Action Taker"
UPDATE MTM_WF_STEP_USER_ACTOR SET ACTOR_TYPE='K' WHERE ACTOR_TYPE='P';

-- By Lun Au (2005-01-25)
-- Description: Workflow task calendar record
ALTER TABLE CALENDAR_RECORD ADD OBJECT_TYPE char(1)
GO
ALTER TABLE CALENDAR_RECORD ADD OBJECT_ID int
GO

-- By Lun Au (2005-01-25)
-- Description: Requested by Zealot
INSERT INTO SYS_PARAMETER VALUES (4014,'calendar.default_timepicker_interval','5','I','Default Timepicker Interval','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00'); 

-- By Lun Au (2005-01-26)
-- Description: Requested by Rollo
INSERT INTO SYS_PARAMETER VALUES (2015,'display.show_no_access_module','false', 'B', 'Whether show no access right modules in menu.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');


-- By Lun Au (2005-01-28)
-- Description: File to DMS on workflow end
ALTER TABLE WORKFLOW_RECORD ADD DMS_PARENT_ID int
GO

-- By Lun Au (2005-02-02)
-- Description: Requested by Roy
INSERT INTO SYS_PARAMETER VALUES (6057,'dms.emailArchive.profile.email.id', '-1', 'S', 'dms emailArchive used profile email type at sys_user_defined_index table id', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6058,'dms.emailArchive.profile.email.detail.mailfrom.id', '-5', 'S', 'dms emailArchive used profile email type mail from field at sys_user_defined_index_detail table id', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6059,'dms.emailArchive.profile.email.detail.mailto.id', '-4', 'S', 'dms emailArchive used profile email type mail to field at sys_user_defined_index_detail table id', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6060,'dms.emailArchive.profile.email.detail.ccto.id', '-3', 'S', 'dms emailArchive used profile email type mail cc to field at sys_user_defined_index_detail table id', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6061,'dms.emailArchive.profile.email.detail.subject.id', '-2', 'S', 'dms emailArchive used profile email type mail subject field at sys_user_defined_index_detail table id', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6062,'dms.emailArchive.profile.email.detail.mailsenddate.id', '-1', 'S', 'dms emailArchive used profile email type mail send date field at sys_user_defined_index_detail table id', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-02-01)
-- Description: Requested by Vera
ALTER TABLE FORM_SUBMISSION ADD DMS_PARENT_ID int
GO

-- By Lun Au (2005-02-18)
-- Description: Requested by Roy
ALTER TABLE DMS_DEFAULT_PROFILE_SETTING ADD USE_SYSTEM_DATE char(1)
GO
ALTER TABLE DMS_DEFAULT_PROFILE_SETTING ADD DEFAULT_SELECT_VALUES nvarchar(2000)
GO
ALTER TABLE DMS_DEFAULT_PROFILE_SETTING ADD DEFAULT_VALUE nvarchar(255)
GO

-- By Lun Au (2005-02-21)
-- Description: Requested by Ryan
INSERT INTO SYS_PARAMETER VALUES (1022,'system.id.generate_by_company_code', '', 'S', 'Table names require ID segment generation', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (1023,'system.multiple_segment', 'false', 'B', 'Enable ID segmentation filtering', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (1024,'system.id_segment_lower_bound', '', 'I', 'Lower bound of each ID segment', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (1025,'system.id_segment_upper_bound', '', 'I', 'Upper bound of each ID segment', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-02-22)
-- Description: Drap and drop workflow designer
INSERT INTO SYS_PARAMETER VALUES (9024,'workflow.show_drag_and_drop_designer', 'false', 'B', 'Enable drag and drop designer', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');


-- By Lun Au (2005-03-16)
-- Requested by Beyond
INSERT INTO SYS_PARAMETER VALUES (6063,'dms.emailArchive.cachefolder.path', 'D:/ParaDM/file/ParaDOC/cache/', 'S', 'dms emailArchive cache folder path', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-03-17)
-- Requested by Ryan
INSERT INTO SYS_PARAMETER VALUES (6064,'dms.index_garbage_collection_interval', '5', 'I', 'Interval of index operations to free system memory', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-03-11)
-- Requested by Vera
--ALTER TABLE FORM_SUBMISSION_HTML ALTER COLUMN PAGE_HTML image NOT NULL;

-- By Lun Au (2005-04-11)
-- Requested by Vera
ALTER TABLE FORM_RECORD ADD START_DATE datetime
GO
ALTER TABLE FORM_RECORD ADD END_DATE datetime
GO

-- By Lun Au (2005-04-21)
-- Requested by Alice
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=4 WHERE ID=8006; 
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=5 WHERE ID=8007;
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=6 WHERE ID=8004;
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=7 WHERE ID=8005;

-- By Lun Au (2005-05-03)
ALTER TABLE AUDIT_TRAIL ALTER COLUMN SESSION_ID nvarchar(255)
GO

-- By Lun Au (2005-03-18)
-- Requested by Ryan
INSERT INTO SYS_PARAMETER VALUES (1026,'system.minimum_login_name_length', '6', 'I', 'Minimum length of login name', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');


-- By Lun Au (2005-05-04)
-- Requested by Ryan
INSERT INTO SYS_PARAMETER VALUES (-1,'system.database_version', '$RCSfile: mssql_alter3.1.6_3.1.7.sql,v $,$Revision: 1.49 $', 'S', 'ParaDM Database Version', 'I', 0, 0, getdate(), 0, getdate());


-- By Lun Au (2005-05-12)
-- Requested by Ryan
UPDATE SYS_USER_DEFINED_INDEX SET ID = '-1',USER_DEFINED_TYPE='Email Archive' WHERE ID = '1001';
UPDATE SYS_USER_DEFINED_INDEX_DETAIL SET ID = '-5',USER_DEFINED_ID='-1' WHERE ID = '1001' AND FIELD_NAME='Mail Form';
UPDATE SYS_USER_DEFINED_INDEX_DETAIL SET ID = '-4',USER_DEFINED_ID='-1' WHERE ID = '1002' AND FIELD_NAME='Mail To';
UPDATE SYS_USER_DEFINED_INDEX_DETAIL SET ID = '-3',USER_DEFINED_ID='-1' WHERE ID = '1003' AND FIELD_NAME='CC To';
UPDATE SYS_USER_DEFINED_INDEX_DETAIL SET ID = '-2',USER_DEFINED_ID='-1' WHERE ID = '1004' AND FIELD_NAME='Subject';
UPDATE SYS_USER_DEFINED_INDEX_DETAIL SET ID = '-1',USER_DEFINED_ID='-1' WHERE ID = '1005' AND FIELD_NAME='Email Sent Date';

UPDATE SYS_PARAMETER SET PARAMETER_VALUE ='-1' WHERE ID = 6057;
UPDATE SYS_PARAMETER SET PARAMETER_VALUE ='-5' WHERE ID = 6058;
UPDATE SYS_PARAMETER SET PARAMETER_VALUE ='-4' WHERE ID = 6059;
UPDATE SYS_PARAMETER SET PARAMETER_VALUE ='-3' WHERE ID = 6060;
UPDATE SYS_PARAMETER SET PARAMETER_VALUE ='-2' WHERE ID = 6061;
UPDATE SYS_PARAMETER SET PARAMETER_VALUE ='-1' WHERE ID = 6062;

--
-- By Tony Chen (2005-05-16)
-- Bug ID 2075 
-- DB column length issue, For handle the Chinese
--
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN CODE	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN ADDRESS1	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN ADDRESS2	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN ADDRESS3	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN CITY	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN STATE	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN USER_DEF_1	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN USER_DEF_2	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN USER_DEF_3	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN USER_DEF_4	NVARCHAR(150)
GO
ALTER TABLE CONTACT_COMPANY	ALTER COLUMN USER_DEF_5	NVARCHAR(150)
GO
ALTER TABLE CONTACT_PERSON	ALTER COLUMN TITLE	NVARCHAR(150)
GO
ALTER TABLE DMS_DOCUMENT	ALTER COLUMN REFERENCE_NO	NVARCHAR(90)
GO
ALTER TABLE DMS_ISSUE	ALTER COLUMN NAME	NVARCHAR(150)
GO
ALTER TABLE DMS_LOC_MASTER	ALTER COLUMN LOC_NAME	NVARCHAR(90)
GO
ALTER TABLE DMS_VERSION	ALTER COLUMN VERSION_LABEL	NVARCHAR(90)
GO
ALTER TABLE DMS_VERSION	ALTER COLUMN REFERENCE_NO	NVARCHAR(90)
GO
ALTER TABLE FORM_GROUP	ALTER COLUMN GROUP_NAME	NVARCHAR(150)
GO
ALTER TABLE FORM_PAGE	ALTER COLUMN PAGE_CODE	NVARCHAR(12)
GO
ALTER TABLE FORM_RECORD	ALTER COLUMN FORM_CODE	NVARCHAR(60)
GO
ALTER TABLE FORM_RECORD	ALTER COLUMN FORM_VERSION	NVARCHAR(30)
GO
ALTER TABLE FORM_RECORD	ALTER COLUMN LAST_PAGE_CODE	NVARCHAR(12)
GO
ALTER TABLE FORM_SUBMISSION_HTML	ALTER COLUMN VERSION	NVARCHAR(30)
GO
ALTER TABLE MTM_WF_RECORD_OBJECT_LINK	ALTER COLUMN WORKFLOW_RULE	NVARCHAR(60)
GO
ALTER TABLE SETUP_OPTION_COUNTRY	ALTER COLUMN COUNTRY_CODE	NVARCHAR(30)
GO
ALTER TABLE SETUP_OPTION_DOC_RELATIONSHIP	ALTER COLUMN RELATIONSHIP_CODE	NVARCHAR(30)
GO
ALTER TABLE STAFF_RECORD	ALTER COLUMN PASSPORT_NO	NVARCHAR(90)
GO
ALTER TABLE STAFF_RECORD	ALTER COLUMN AREA_CODE	NVARCHAR(30)
GO
ALTER TABLE USER_GROUP	ALTER COLUMN GROUP_NAME	NVARCHAR(150)
GO
ALTER TABLE USER_RECORD	ALTER COLUMN LOCALE	NVARCHAR(30)
GO
ALTER TABLE USER_ROLE	ALTER COLUMN ROLE_NAME	NVARCHAR(150)
GO
ALTER TABLE WORKFLOW_GROUP	ALTER COLUMN GROUP_NAME	NVARCHAR(150)
GO
ALTER TABLE WORKFLOW_RECORD	ALTER COLUMN WORKFLOW_CODE	NVARCHAR(60)
GO
ALTER TABLE WORKFLOW_RECORD	ALTER COLUMN WORKFLOW_VERSION	NVARCHAR(30)
GO

-- By Roy Wong (2005-05-25)
-- Specify the archive excel report size
INSERT INTO SYS_PARAMETER VALUES (6065,'dms.archive_excel_size','2M','I','Archive excel size','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-05-26)
-- Requested by Roy
INSERT INTO SYS_PARAMETER VALUES (6068,'dms.archive_file_path','D:/ParaDM/file/ParaDOC','S','Archive folders location','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-06-06)
-- Requested by Ryan (To fix wrong ID assignment of system.authentication.method)
UPDATE SYS_PARAMETER SET ID = 1027 WHERE PARAMETER_CODE='system.authentication.method';
DELETE FROM SYS_PARAMETER WHERE ID=11112;

-- By Lun Au (2005-06-13)
-- Requested by Vera (To enlarge the form data field)
ALTER TABLE FORM_DATA ALTER COLUMN DATA_STRING nvarchar(4000)
GO

-- By Lun Au (2005-07-07)
-- Requested by Ryan
INSERT INTO SYS_PARAMETER VALUES (13001, 'crystalreport.server_host', '', 'S', 'Crystal Report server host name', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (13002, 'crystalreport.server_port', '', 'I', 'Crystal Report server port number', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (13003, 'crystalreport.viewer_path', '/businessobjects/viewrpt.cwr', 'S', 'Crystal Report server viewer path', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (13004, 'crystalreport.username', 'Administrator', 'S', 'Crystal Report viewer login name for report generation', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (13005, 'crystalreport.password', '', 'S', 'Crystal Report viewer login password for report generation', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (13006, 'crystalreport.default_export_format', 'U2FPDF:0', 'S', 'Crystal Report default export format', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-07-19)
-- Requested by Zealot
ALTER TABLE CALENDAR_PERFERENCE ADD DEFAULT_GROUP INT
GO

-- By Lun Au (2005-07-26)
-- Requestd by Tomy (done by Dick)
ALTER TABLE WORKFLOW_ACTION CHANGE WORKFLOW_CATEGORY_ID WORKFLOW_CATEGORY_ID BIGINT(20)
GO
INSERT INTO WORKFLOW_ACTION VALUES (26,'workflow.action.label.auto_complete', NULL, 'com.dcivision.workflow.action.AutomaticComplete', 'A', 0, 0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO WORKFLOW_ACTION VALUES (27,'workflow.action.label.auto_rollback_pre_step', NULL, 'com.dcivision.workflow.action.AutoRollbackPreStep', 'A', 0, 0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-06-06)
-- Requested by Rollo (For Lotus Notes Mail Sending)
INSERT INTO SYS_PARAMETER VALUES (12001, 'domino.host', '', 'S', 'Lotus Domino host name', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (12002, 'domino.ior_file_path', '', 'S', 'Lotus Domino DIIOP IOR file path', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (12003, 'domino.username', '', 'S', 'Lotus Domino user name for sending mail', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (12004, 'domino.password', '', 'S', 'Lotus Domino password for sending mail', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-07-04)
-- Requested by Rollo (For Lotus Domino email sending)
INSERT INTO SYS_PARAMETER VALUES (12005, 'domino.db_file_host', '', 'S', 'Lotus Domino internal host name of mail database', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (12006, 'domino.db_file_path', '', 'S', 'Lotus Domino mail database file path', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-09-06)
-- Requested by Samlin for enhancement 3250
UPDATE SYS_FUNCTION SET DISPLAY_SEQ= DISPLAY_SEQ+1 WHERE DISPLAY_SEQ>4 and PARENT_ID=8000 ;
INSERT INTO SYS_FUNCTION VALUES (8009,'WFM_DELEGATE', 'Delegation', N'工作代辦', N'工作代辦', 8000, '/workflow/ListWorkflowDelegation.do', 5, 'S', 'RIECD', 'A', 0, '2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-09-26)
-- Requested by Vera
ALTER TABLE FORM_SUBMISSION_HTML ALTER COLUMN STATUS CHAR(1)
GO

-- By Lun Au (2005-09-28)
-- Requested by Ryan
UPDATE SYS_PARAMETER SET PARAMETER_CODE='calendar.default_timepicker_interval' WHERE ID=4014;

-- By Lun Au (2005-09-29)
-- Requested by Anson, bug 3605
ALTER TABLE USER_RECORD ADD MODIFY_LOGIN_PWD CHAR(1)
GO
UPDATE USER_RECORD SET MODIFY_LOGIN_PWD='Y';
INSERT INTO SYS_FUNCTION VALUES (1009,'STP_PASSWORD','Password Setup',N'密碼設定',N'密�?设定','1000','/setup/ListPassword.do',9,'S','RE','A','0','2000-01-01 00:00:00','0','2000-01-01 00:00:00');

-- By Lun Au (2005-09-29)
-- Requested by Jenny
INSERT INTO SYS_PARAMETER VALUES (6071,'dms.show_no_access_public_folder','false','B','Determine whether to show non-accessible public folder','A',0,0,'2000-01-01 00:00:00','0','2000-01-01 00:00:00');

-- By Lun Au (2005-09-30)
-- Requested by Anson, bug 3566
INSERT INTO SYS_PARAMETER VALUES (1031, 'system.modify_password', 'true','B','Allow user to modify password. Default is true','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-10-10)
-- Requested by Anson, bug 3701
INSERT INTO SYS_PARAMETER VALUES (6072, 'dms.display_no_access_document', 'true','B','Determine whether to show non-accessible documents.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-10-12)
-- Requestd by Ryan
INSERT INTO SYS_PARAMETER VALUES (6073, 'dms.file_rollover_limit', '0','I','Define how many files to store in each subfolder within the same location root, set to 0 for unlimited storage','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
ALTER TABLE DMS_CONTENT ADD CONTENT_PATH INT DEFAULT NULL
GO

-- By Lun Au (2005-10-14)
-- Requested by Anson, bug fix 3703
ALTER TABLE DMS_LOC_MASTER ADD SEGMENT_NO INT
GO
DECLARE @DefaultConstraintName sysname 
SELECT 
    @DefaultConstraintName = OBJECT_NAME(constid) 
FROM 
    sysconstraints 
WHERE 
    OBJECT_NAME(id) = 'DMS_CONTENT' AND 
    COL_NAME(id, colid) = 'CONTENT_PATH' AND 
    OBJECTPROPERTY(constid, 'IsDefaultCnst') = 1 

IF @DefaultConstraintName IS NOT NULL 
    EXEC('ALTER TABLE DMS_CONTENT DROP CONSTRAINT ' + 
@DefaultConstraintName) 

ALTER TABLE DMS_CONTENT DROP COLUMN CONTENT_PATH
GO 
ALTER TABLE DMS_CONTENT ADD SEGMENT_NO INT
GO

-- By Lun Au (2005-10-14)
-- Requested by Beyond
INSERT INTO SYS_PARAMETER VALUES (6074, 'dms.not_inherit_from_parent', 'true','B','Set to true to disable default file access right inheritance','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-10-19)
-- Requested by Jenny
INSERT INTO SYS_PARAMETER VALUES (6084, 'dms.scan_enable', 'false','B','Select true to enable scan.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-10-27)
-- Requested by Jenny
INSERT INTO SYS_PARAMETER VALUES (6085, 'dms.scan_folder_creation_bypass_security','true','B','Specify true if access right checking should be by-passed for creating folder during scanning process','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-11-02)
-- Requested by Jenny
ALTER TABLE SYS_USER_DEFINED_INDEX_DETAIL ADD DISPLAY_SEQ INT NOT NULL
GO
UPDATE SYS_USER_DEFINED_INDEX_DETAIL SET DISPLAY_SEQ=0 WHERE DISPLAY_SEQ IS NULL;

-- By Lun Au (2005-11-07)
-- Requested by Anson
INSERT INTO SYS_PARAMETER VALUES (6086,'dms.list.pageAmount','5','I','Page amount of list page','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-11-08)
-- Requested by Beyond
INSERT INTO SYS_PARAMETER VALUES (6087,'dms.emailArchive.default.host.address','','S','The default email archive email host','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-11-09)
-- Requested by Jenny
INSERT INTO SYS_PARAMETER VALUES (2016, 'display.show_function_menu','true','B','Whether show function menu','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6088, 'dms.show_download_button','true','B','Whether show download button','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-11-15)
-- Requested by Samlin (bug 3907)
ALTER TABLE MTM_WF_STEP_NOTIFY_RULE ALTER COLUMN NOTIFY_TRIGGER VARCHAR(4)
GO
INSERT INTO SYS_PARAMETER VALUES (9026,'workflow.mail_approved_by_user_notification_subject', 'PARA Flow Task Approved By User Notification', 'S', 'Email Subject for Task Approved By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9027,'workflow.mail_rejected_by_user_notification_subject', 'PARA Flow Task Rejected By User Notification', 'S', 'Email Subject for Task Rejected By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9028,'workflow.mail_selected_yes_by_user_notification_subject', 'PARA Flow Task Selected Yes By User Notification', 'S', 'Email Subject for Task Selected Yes By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9029,'workflow.mail_selected_no_by_user_notification_subject', 'PARA Flow Task Selected No By User Notification', 'S', 'Email Subject for Task Selected No By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9030,'workflow.mail_selected_decision_by_user_notification_subject', 'PARA Flow Task Selected {0} By User Notification', 'S', 'Email Subject for Task Selected Route By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-11-18)
-- Requested by Anson, bug 4027
INSERT INTO SYS_PARAMETER VALUES (6089, 'dms.clear_cache_file.trigger_time','00:00','S','The time to clean up document cache.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6090, 'dms.clear_cache_file.trigger_interval','1','I','The number of days the document cache will be kept.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-11-28)
-- Requested by Rollo
INSERT INTO SYS_PARAMETER VALUES (6091,'dms.show_direct_url','false','B','Whether show the Direct URL link in the context menu.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-12-08)
-- Requested by Anson
ALTER TABLE UPDATE_ALERT ADD NOTIFY_SELF CHAR(1)
GO

-- By Lun Au (2005-12-01)
-- Requested by Vera
ALTER TABLE FORM_RECORD ADD DISPLAY_ELEMENT_ID INT
GO

-- By Lun Au (2005-12-28)
-- Requested by Beyond
UPDATE SYS_FUNCTION SET PERMISSION_TYPE = 'RP' WHERE ID = 1007;
UPDATE SYS_FUNCTION SET PERMISSION_TYPE = 'RE' WHERE ID = 5002;
UPDATE SYS_FUNCTION SET PERMISSION_TYPE = 'R' WHERE ID = 6005;

-- By Lun Au (2006-01-25)
-- Requested by Beyond
INSERT INTO SYS_PARAMETER VALUES (15000,'contact.enable.internal.users','false','B','Enable the use of internal users.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2006-02-07)
-- Requested by Beyond
INSERT INTO SYS_PARAMETER VALUES (6092, 'dms.need_check_tree_permission','true','B','Determines whether to check permission on the tree nodes of the folder structure.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2006-02-24)
-- Requested by Beyond
CREATE NONCLUSTERED INDEX EFFECTIVE_DATE_INDEX1 ON DMS_DOCUMENT (EFFECTIVE_END_DATE,EFFECTIVE_START_DATE)
GO

-- By Lun Au (2006-03-07)
-- Requested by Samlin
DROP INDEX MTM_WF_STEP_WF_STEP.PARENT_TYPE;
ALTER TABLE MTM_WF_STEP_WF_STEP ALTER COLUMN PARENT_TYPE VARCHAR(3)
GO
CREATE NONCLUSTERED INDEX PARENT_TYPE ON  MTM_WF_STEP_WF_STEP  (PARENT_TYPE)
GO
UPDATE MTM_WF_STEP_WF_STEP SET PARENT_TYPE=LTRIM(RTRIM(PARENT_TYPE));

-- By Lun Au (2006-03-16)
-- Requested by Zealot
INSERT INTO SYS_PARAMETER VALUES (1032, 'system.default_max_attempt', '3','I','Default Maximum Attempt','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (1033, 'system.default_password_expiry_day', '90','I','Default Password Expiry Day','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2006-04-03)
-- Requested by Samlin
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='2', PARAMETER_DEFAULT_VALUE='2' WHERE PARAMETER_CODE='workflow.max_priority';

-- Requested by Ferdinand
ALTER TABLE FORUM_GROUP_DETAIL ADD NUM_OF_READS INT;
GO
UPDATE FORUM_GROUP_DETAIL SET NUM_OF_READS=READS;
ALTER TABLE FORUM_GROUP_DETAIL DROP COLUMN READS
GO

-- By Lun Au (2006-04-21)
-- Form submission performance tuning
CREATE NONCLUSTERED INDEX FDE_PAGE_ID ON  FORM_DATA_ELEMENT (PAGE_ID)
GO
CREATE NONCLUSTERED INDEX FDE_SECTION_ID ON  FORM_DATA_ELEMENT (SECTION_ID)
GO
CREATE NONCLUSTERED INDEX FDE_ELEMENT_ID ON  FORM_DATA_ELEMENT (ELEMENT_ID)
GO
CREATE NONCLUSTERED INDEX FDE_SUBMISSION_ID ON  FORM_DATA_ELEMENT (SUBMISSION_ID)
GO
CREATE NONCLUSTERED INDEX FDE_WORKFLOW_PROGRESS_ID ON  FORM_DATA_ELEMENT (WORKFLOW_PROGRESS_ID)
GO

-- By Lun Au (2006-04-26)
-- Requested by Jenny, Bug 4536
INSERT INTO SYS_PARAMETER VALUES (9031, 'workflow.support_interruption_completed_workflow', 'false', 'B', 'Determines whether allow interruption after workflow end', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO WORKFLOW_ACTION VALUES (24,'workflow.action.label.subworkflow_approve_interrupt_request', 15, 'com.dcivision.workflow.action.ApproveInterruptRequest', 'A', 0, 0,getdate(),0,getdate());

-- By Lun Au (2006-04-28)
-- Requested by Beyond/Jenny
INSERT INTO SYS_PARAMETER VALUES (6093, 'dms.emailArchive.lotus.share.folder','','S','Email archive lotus share folder.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9032, 'workflow.interruption_include_autotask','false', 'B', 'Determines whether allow interrupt to an automatic task', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-06-24)
-- Requested by Jenny, for bug 2451
INSERT INTO SYS_PARAMETER VALUES (6065,'dms.archive_excel_size','2M','I','Archive excel size','A',0,0,getdate(),0,getdate());
INSERT INTO SYS_PARAMETER VALUES (6069,'dms.enable_archive_excel_file','true','B','Determine whether to have excel report file in archive','A',0,0,getdate(),0,getdate());

-- By Lun Au (2005-08-31)
-- Requested by Beyond
INSERT INTO SYS_PARAMETER VALUES (6070, 'dms.zip_file_default_encoding', '', 'S','Zip download default encoding','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2006-11-13)
-- Requested by Ryan Kwan, EIP-968
UPDATE SYS_PARAMETER SET PARAMETER_TYPE='S' WHERE ID=6047
GO

--
-- THIS STATEMENT SHOULD ALWAYS BE PUT AT THE LAST ROW OF THIS FILE
--
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='$RCSfile: mssql_alter3.1.6_3.1.7.sql,v $,$Revision: 1.49 $', UPDATE_COUNT=UPDATE_COUNT+1, UPDATE_DATE=getdate() WHERE ID = -1;
